import requests
import json


def getContentListByDirId():
    '''
    获取全国所有的5A级景区名称
    '''
    url = "https://www.mct.gov.cn/tourism/api/content/getContentListByDirId"

    data = {
        "directoryId": "4",
        "searchList": [],
        "size": 358,
        "page": 1
    }

    res = requests.post(url=url, json=data)

    result = json.loads(res.content)

    # 获取总页数
    total_pages = result['data']['contentList']['totalPages']

    for jq_mes in result['data']['contentList']['content']:
        print(jq_mes['name'])



if __name__ == '__main__':
    getContentListByDirId()
